package com.rr.mymoney.bo.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.rr.mymoney.bo.AccountBo;
import com.rr.mymoney.dao.AccountDao;
import com.rr.mymoney.model.Account;
import com.rr.mymoney.utils.BoImplUtils;

@Service
public class AccountBoImpl implements AccountBo {
    private AccountDao accountDao;

    @Autowired
    private AccountBoImpl(AccountDao accountDao) {
	super();
	this.accountDao = accountDao;
    }

    public void saveOrUpdate(Account account) {
	accountDao.saveOrUpdate(account);
    }

    public Account get(Long id) {
	return accountDao.get(id);
    }

    public void delete(Account account) {
	accountDao.delete(account);
    }

    public List<Account> getByUserId(Long userId) {
	return accountDao.getByUserIds(BoImplUtils.getAsList(userId));
    }
}
